package com.ruoyi.iot.domain;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class IotQueryResult {

    private final List<String> columns;
    private final List<String> columnTypes;
    private final List<Map<String, Object>> rows;

    public IotQueryResult(List<String> columns, List<String> columnTypes, List<Map<String, Object>> rows) {
        if (columns == null) {
            this.columns = Collections.emptyList();
        } else {
            this.columns = Collections.unmodifiableList(new ArrayList<>(columns));
        }
        if (columnTypes == null) {
            this.columnTypes = Collections.emptyList();
        } else {
            this.columnTypes = Collections.unmodifiableList(new ArrayList<>(columnTypes));
        }
        if (rows == null) {
            this.rows = Collections.emptyList();
        } else {
            this.rows = Collections.unmodifiableList(new ArrayList<>(rows));
        }
    }

    public List<String> getColumns() {
        return columns;
    }

    public List<String> getColumnTypes() {
        return columnTypes;
    }

    public List<Map<String, Object>> getRows() {
        return rows;
    }
}
